package com.anxin.common.constant;

/**
 * 安全相关常量
 */
public class SecurityConstants {
    // JWT相关常量
    public static final String TOKEN_HEADER = "Authorization";
    public static final String TOKEN_PREFIX = "Bearer ";
    public static final String TOKEN_TYPE = "JWT";

    // 令牌有效期（毫秒）
    public static final long ACCESS_TOKEN_EXPIRE_TIME = 1000 * 60 * 30; // 30分钟
    public static final long REFRESH_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 7; // 7天

    // JWT密钥文件路径
    public static final String RSA_PRIVATE_KEY = "classpath:key/private_key.pem";
    public static final String RSA_PUBLIC_KEY = "classpath:key/public_key.pem";

    // Redis缓存前缀
    public static final String REDIS_LOGIN_KEY_PREFIX = "login:";
    public static final String REDIS_BLACKLIST_KEY_PREFIX = "blacklist:";
    public static final String REDIS_LOGIN_FAIL_KEY_PREFIX = "login:fail:";

    // 登录失败限制次数
    public static final int LOGIN_FAIL_MAX_COUNT = 5;
    public static final long LOGIN_FAIL_EXPIRE_TIME = 1000 * 60 * 30; // 30分钟

    // 角色定义
    public static final String ROLE_ADMIN = "ADMIN";
    public static final String ROLE_DOCTOR = "DOCTOR";
    public static final String ROLE_PATIENT = "PATIENT";
}
